package other;

public class forCla {
    public static void main(String[] args) {
        int[] arr = new int[]{9,8,76,5,4,3,2,2,1};
        SortAlgorithm sortAlgorithm = new SortAlgorithm();
        int[] arr1 = sortAlgorithm.maoPao(arr);
        for (int i : arr1) {
            System.out.println(i);
        }
    }
}
class SortAlgorithm{
    public int[] maoPao(int[] arr){
        int h = 0;
        for(int i = 0;i < arr.length - 1;i++){
            h = 0;
            for(int j = 0;j < arr.length - i - 1;j++){
                if(arr[h] > arr[h+1]){
                    int n = arr[h];
                    arr[h] = arr[h+1];
                    arr[h+1] = n;
                }
                h++;
            }
        }
        return arr;
    }
}